home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #6 / Amiga Plus CD - 2004 - No. 06.iso / AmigaPlus / Begleitmaterial / 50Tools / Grafik / PerfectPaint / rexx / bridge / RotFull.rx < prev    next >
Text File  |  2001-11-11  |  1KB  |  73 lines

  1. /**/
  2.  
  3.     call addlib("rexxmathlib.library", 5, -30, 0)
  4.  
  5.     options results 
  6.     parse ARG Port1 RealMain Main3_h Angle b
  7.  
  8.   ADDRESS value Port1 
  9.  
  10.     Pi=3.1414926
  11.  
  12.   co=Cos(Angle/180*Pi)
  13.   si=Sin(Angle/180*Pi)
  14.  
  15.   cx=RealMain/2
  16.   cy=Main3_h/2
  17.  
  18.   x0=(0-cx)*co-((0-cy)*si-cx)
  19.   y0=(0-cx)*si+((0-cy)*co+cy)
  20.   x1=(0-cx)*co-((Main3_h-1-cy)*si-cx)
  21.   y1=(0-cx)*si+((Main3_h-1-cy)*co+cy)
  22.   x2=(RealMain-1-cx)*co-((Main3_h-1-cy)*si-cx)
  23.   y2=(RealMain-1-cx)*si+((Main3_h-1-cy)*co+cy)
  24.   x3=(RealMain-1-cx)*co-((0-cy)*si-cx)
  25.   y3=(RealMain-1-cx)*si+((0-cy)*co+cy)
  26.  
  27.   X=MIN(x0,x1,x2,x3)
  28.   Y=MIN(y0,y1,y2,y3)
  29.   XX=MAX(x0,x1,x2,x3)
  30.     YY=MAX(y0,y1,y2,y3)
  31.  
  32.   W=XX-X+3
  33.   H=YY-Y+3
  34.  
  35.     X=X-1
  36.     Y=Y-1
  37.  
  38.     pp_GetDepth
  39.     D=result
  40.     
  41.     pp_GetCurrentBuffer
  42.     CBf=result
  43.  
  44.     if D<24 then DO
  45.         pp_Psave "ram:palette.trash" 0
  46.     END
  47.  
  48.     pp_FindEmptyBuffer
  49.     flag=result
  50.     if flag=-1 then DO
  51.         pp_Warn "can't*find*empty|Buffer."
  52.         EXIT        
  53.     END
  54.  
  55.     pp_SetBuffer flag
  56.     pp_new W H D
  57.     pp_GetWidth
  58.     IF result=0 then DO
  59.         pp_Warn "Not*enough*memory."
  60.         EXIT            
  61.     END
  62.  
  63.     IF D<24 then DO
  64.         pp_Pload "ram:palette.trash"
  65.         ADDRESS COMMAND
  66.         'delete >nil: ram:palette.trash'
  67.         ADDRESS value Port1
  68.     END
  69.     
  70.     Dev_Rotate X Y CBf
  71.  
  72.     EXIT    
  73.